import axios from "~/http/request"
import qs from 'qs';

// 登录
export const loginReq = (data) => {
    return axios({
        url: `/rpan-authority/oauth/token`,
        method: "post",
        data: qs.stringify(data),
        config: {
            headers: {
                "zfile-token": `Basic ${btoa("superuser:123456")}`,
                "Content-Type": "application/x-www-form-urlencoded"
            }
        }
    })
}

// 获取登录验证方式
export const loginVerifyModeReq = () => {
    return axios({
        url: "/rpan-authority/admin/login/verify-mode",
        method: "get"
    })
}

// 获取登录图片验证码
export const loginVerifyImgReq = () => {
    return axios({
        url: "/rpan-authority/admin/login/captcha",
        method: "get"
    })
}

// 注销
export const logoutReq = () => {
    return axios({
        url: "/rpan-authority/admin/logout",
        method: "post",
    })
}

// 检查是否已登录
export const checkLoginReq = () => {
    return axios({
        url: "/rpan-authority/admin/login/check",
        method: "get",
    })
}